Page({
  data: {
    dashboard: {
      todayOrders: 15,
      todayRevenue: 2850.00,
      totalUsers: 1280,
      verifiedTechnicians: 45,
      completionRate: 92.5,
      satisfactionRate: 96.8
    },
    pending: {
      technicians: 3,
      refunds: 1,
      complaints: 2
    }
  },

  onLoad: function() {
    this.loadDashboardData();
  },

  loadDashboardData: function() {
    const app = getApp();
    
    app.request({
      url: `${app.globalData.baseUrl}/admin/dashboard/`,
      success: (res) => {
        if (res.statusCode === 200) {
          this.setData({
            dashboard: res.data
          });
        }
      }
    });
    
    // 获取待处理事项
    app.request({
      url: `${app.globalData.baseUrl}/admin/pending/`,
      success: (res) => {
        if (res.statusCode === 200) {
          this.setData({
            pending: res.data
          });
        }
      }
    });
  },

  goToTechnicianList: function() {
    wx.navigateTo({
      url: '/pages/admin/technicianList'
    });
  },

  goToRefundList: function() {
    wx.navigateTo({
      url: '/pages/admin/refundList'
    });
  },

  goToComplaintList: function() {
    wx.navigateTo({
      url: '/pages/admin/complaintList'
    });
  },

  goToUserList: function() {
    wx.navigateTo({
      url: '/pages/admin/userList'
    });
  },

  goToOrderList: function() {
    wx.navigateTo({
      url: '/pages/admin/orderList'
    });
  },

  goToContent: function() {
    wx.navigateTo({
      url: '/pages/admin/contentManagement'
    });
  }
})